#!/usr/bin/env node

const {
  Command
} = require('commander');
const pkg = require('./package.json')
const program = new Command();
program.version(pkg.version);


program
  .command('login')
  .description("登录语雀")
  .action(require('./src/commander/login'))

program
  .command('info')
  .description("查看存储信息")
  .action(require('./src/commander/info'))

program
  .command('clear')
  .description("删除本地信息")
  .action(require('./src/commander/clear'))

program
  .command('save')
  .alias('s')
  .option('-p, --path <path>', '保存文章的路径', '')
  .description("保存文档")
  .action(require('./src/commander/save'))

program
  .command('list')
  .option('-a, --all', '是否下载全部文档', false)
  .option('-p, --path <path>', '存在在那个文件夹', '')
  .alias('ls')
  .description("查看文档")
  .action(require('./src/commander/list'))

program
  .command('compression')
  .alias('cm')
  .option('-c, --rename', '是否添加名称后缀.min ', false)
  .option('-p, --path <path>', '压缩哪个文件夹', '')
  .alias('ls')
  .description("压缩png图片")
  .action(require('./src/commander/compression'))




program.parse(process.argv);

process.on('unhandledRejection', error => {
  // Will print "unhandledRejection err is not defined"
  console.log(error);
});